<?php
#region CODE
    use Gotcha\App\Framework\Controller;
    use Gotcha\App\Extensions\GotchaRoutingExtension;
    $framework = new Controller();
    $currentUrl = new GotchaRoutingExtension();
#endregion
?>
    <div id="layout-newsletter">
        <div>
            <img alt="Newsletter" src="<?= $framework->UrlContent('/Themes/Jasminum.Theme/Styles/Images/newsletter.png'); ?>">
        </div>
        <div>
            <form method="post" action="<?= $framework->UrlContent('/JasminumNewsletter/Send'); ?>">
                <?php if(!isset($_GET['errors'])): ?>
                    <input type="text" id="Email" name="Email" placeholder="Twój e-mail">
                <?php else: ?>
                    <input type="text" id="Email" name="Email" value="Niepoprawny email!" class="error">
                <?php endif; ?>
                <input type="hidden" name="ReturnURL" value="<?= $currentUrl; ?>">
                <button>Wyślij</button>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        $('#Email').click(function() {
            if($(this).hasClass('error')) {
                $(this).removeClass('error');
                $(this).val('');
            }
        });
    </script>